package com.doit.day01;


import java.sql.*;

public class Test {
    public static void main(String[] args) throws Exception {

        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "123456");
        PreparedStatement pps = conn.prepareStatement("select * from hero where id > ? and id < ?");

        pps.setInt(1,1);
        pps.setInt(2,5);

        ResultSet resultSet = pps.executeQuery();

        while (resultSet.next()){
            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            int age = resultSet.getInt("age");
            int face_value = resultSet.getInt(4);
            int power = resultSet.getInt(5);
            System.out.println(id+","+name+","+age+","+face_value+","+power);
        }
    }
}
